package com.gxa.service.impl;

import com.gxa.common.R;
import com.gxa.mapper.PurchaseReportMapper;
import com.gxa.service.PurchaseReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class
PurchaseReportImpl implements PurchaseReportService {
    R r=new R();
    @Autowired(required = false)
    private PurchaseReportMapper purchaseReportMapper;
    @Override
    public R queryPurchaseReport(Map map) {
       List<Map> result=purchaseReportMapper.queryPurchaseReport(map);
        if (result!=null){
           r.setCode(200);
           r.setMsg("success");
           r.setData(result);
        }
        return r;
    }

    @Override
    public R querySalesReport(Map map) {
        List<Map> result=purchaseReportMapper.querySalesReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryCorrespondentunit(Map map) {
        int result=purchaseReportMapper.customerCopy();
        int result2=purchaseReportMapper.supplierCopy();
        int result3=purchaseReportMapper.customerMoney();
        int result4=purchaseReportMapper.supplierMoney();
        List<Map> result5=purchaseReportMapper.queryCorrespondentunit(map);
        if (result5!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result5);
        }
        return r;
    }

    @Override
    public R queryWarehouseReport(Map map) {
        List<Map> result=purchaseReportMapper.queryWarehouseReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R querySalesprofitReport(Map map) {
        List<Map> result=purchaseReportMapper.querySalesprofitReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryRmbReport(Map map) {
        List<Map> result=purchaseReportMapper.queryRmbReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryAccountsReport(Map map) {
        List<Map> result=purchaseReportMapper.queryAccountsReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryAccountStatementReport(Map map) {
        List<Map> result=purchaseReportMapper.queryAccountStatementReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryOtherincomeandexpenditureReport(Map map) {
        List<Map> result=purchaseReportMapper.queryOtherincomeandexpenditureReport(map);
        if (result!=null){
            r.setCode(200);
            r.setMsg("success");
            r.setData(result);
        }
        return r;
    }

    @Override
    public R queryAllReport() {
        List<Map> result=purchaseReportMapper.querywarehouse();
        List<Map> result1=purchaseReportMapper.queryaccountmoney();
        List<Map> result2=purchaseReportMapper.queryarrears();
        List<Map> result3=purchaseReportMapper.querysalesmoney();
        List<Map> result4=purchaseReportMapper.querypurchase();
        List list=new ArrayList();
        list.add(result);
        list.add(result1);
        list.add(result2);
        list.add(result3);
        list.add(result4);
        r.setCode(200);
        r.setMsg("success");
        r.setData(list);
        return r;
    }


}
